package com.briup.pts.web.controller;

import com.briup.pts.aop.TestAop;
import com.briup.pts.config.response.Result;
import com.briup.pts.service.AnalysisService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


@Tag(name = "大屏展示模块")
@RequiredArgsConstructor
@RequestMapping("/analysis")
@RestController
public class AnalysisController {

    private final AnalysisService service;

    @Operation(summary = "统计动物体重信息")
    @GetMapping("/indexCount")
    public Result<?> indexCount() {
        Map<String, Integer> indexCount = service.indexCount();
        return Result.success(indexCount)
                .apply("获取成功");
    }

    @TestAop
    @Operation(summary = "统计栏舍，栏圈，动物，冷库，员工数量信息")
    @GetMapping("/count")
    public Result<?> count() {
        Map<String, List<?>> count = service.count();
        return Result.success(count)
                .apply("获取成功");
    }

    @Operation(summary = "统计动物病症数量接口")
    @GetMapping("/countDisease")
    public Result<?> diseaseCount() {
        Map<String, Integer> count = service.diseaseCount();
        return Result.success(count)
                .apply("获取成功");
    }

    @Operation(summary = "统计本年度12个月销售动物接口")
    @GetMapping("/countSales")
    public Result<?> salesCount() {
        Map<String, List<?>> count = service.salesCount();
        return Result.success(count)
                .apply("获取成功");
    }
}
